home *** CD-ROM | disk | FTP | other *** search
/ CDUTIL 13 / CDUTIL #13 Julio 1995.iso / windows / acadcom / ads / adslib.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-02-08  |  5.5 KB  |  202 lines

  1. /*    
  2.  
  3.    ADSLIB.H
  4.  
  5.    Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994 by Autodesk, Inc.
  6.  
  7.    Permission to use, copy, modify, and distribute this software in 
  8.    object code form for any purpose and without fee is hereby granted, 
  9.    provided that the above copyright notice appears in all copies and 
  10.    that both that copyright notice and the limited warranty and 
  11.    restricted rights notice below appear in all supporting 
  12.    documentation.
  13.  
  14.    AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.  
  15.    AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF 
  16.    MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.  AUTODESK, INC.
  17.    DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE 
  18.    UNINTERRUPTED OR ERROR FREE.
  19.  
  20.    Use, duplication, or disclosure by the U.S. Government is subject to 
  21.    restrictions set forth in FAR 52.227-19 (Commercial Computer 
  22.    Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) 
  23.    (Rights in Technical Data and Computer Software), as applicable.
  24.     
  25.    .
  26.  
  27.    ADS definitions and system dependent controls.
  28.  
  29.    This also contains a substitute for stdlib.h on some systems.
  30.    If we know the system has stdlib.h, just include it.
  31.  
  32. */
  33.  
  34. #ifndef _adslib_h
  35. #define _adslib_h 1
  36.  
  37. #ifdef _MAXSTRING
  38. #undef    _MAXSTRING
  39. #define   _MAXSTRING  (~0)
  40. #endif
  41.  
  42.   
  43. /* Note: As of this writing, Sun ANSI C defines __STDC__, but
  44.    sets it to a non-numeric value.  This is contrary to the
  45.    ANSI standard, but we'll live with it for now.  Hence the
  46.    unusual handling of __STDC__. */
  47.  
  48. #ifdef __STDC__
  49. #define STDC_DEFINED 1
  50. #else
  51. #define STDC_DEFINED 0
  52. #endif
  53.  
  54. #ifdef _WINDOWS
  55. #define WIN 1
  56. #endif
  57.  
  58. #ifdef WINVER
  59. #define WIN 1
  60. #endif
  61.  
  62. #ifdef _MSC_VER
  63. #define MICROSOFT 1
  64. #endif
  65.  
  66. #ifdef __TURBOC__
  67. #define TURBOC 1
  68. #endif
  69.  
  70. #ifdef WIN
  71. #define main(a,b) ads_main(a,b)
  72. #define PROTOTYPES 1
  73. #endif  /* WIN */
  74.  
  75. #ifndef PROTOTYPES
  76. #if STDC_DEFINED || defined(__cplusplus)  /* "Standard C" or C++ */
  77. #define PROTOTYPES 1
  78. #endif  /* STDC_DEFINED || __cplusplus */
  79. #endif  /* !PROTOTYPES */
  80.  
  81. /*  Tricky macro for declaration of function types with optional
  82.     prototype (i.e., declaration of argument types).  The way the
  83.     macro "_()" is defined, the following declaration:
  84.  
  85.        int fcn _((int i, char c));
  86.  
  87.     will expand into either
  88.  
  89.        int fcn (int i, char c);
  90.        or
  91.        int fcn ();
  92.  
  93.     depending on whether the symbol PROTOTYPES is defined.  Thanks to
  94.     Bob Elman for this idea.  */
  95.  
  96. #ifdef PROTOTYPES
  97. #define   _(x)  x
  98. #else
  99. #define   _(x)  ()
  100. #endif /* PROTOTYPES */
  101.  
  102.  
  103.  
  104. /* Substitute for STDLIB.H on systems that do NOT have it.
  105.    Also enable use of const in adsxxx.h declarations.  */
  106.  
  107. #ifndef ACRXAPP
  108.  
  109. #if       STDC_DEFINED || defined(__cplusplus) || WIN
  110. #include  <stdlib.h>
  111. #else
  112.  
  113. /* Declaration for ?alloc() was set to char * because that caused us fewer
  114.    compiler warnings in some substandard systems.  Now we declare it as ANSI
  115.    standard by default.  The Sparc compiler works fine with this, though the
  116.    obsolete lint on Unix screams its ancient head off.  (Serious programmers
  117.    use Gimpel's PC-Lint.)
  118.  
  119.    Any exceptions to the proper ANSI-style declaration must be explicitly
  120.    machine by machine. 
  121.    5/26/94
  122. */
  123.  
  124. void *malloc _((size_t size));
  125. void *calloc _((unsigned int nelem, size_t elsize));
  126. void free _((void *ptr));
  127. void *realloc(void *, size_t);
  128. #ifndef TURBOC
  129. double atof _((char *nptr));
  130. #endif
  131. int atoi _((char *nptr));
  132. void exit _((int status));
  133. double fmod _((double x, double y));
  134.  
  135. /* Enable the use of const on machines that support it (by making it disappear
  136.    on these non-standard machines). */
  137. #ifndef const
  138. #define const                         /* Make const invisible for adsxxx.h */
  139. #define _adslib_h_const               /* Flag for later */
  140. #endif  /* !const */
  141. #endif  /*STDC_DEFINED || __cplusplus || WIN */
  142.  
  143. #endif  /* !ACRXAPP */
  144.  
  145. #include "ads.h"
  146. #include "adscodes.h"
  147.  
  148. #if defined(ACRXAPP) && defined(solaris)
  149. /*
  150.             And except we will... For the Rx environment on
  151.             Solaris , we will redefine malloc, realloc, free and calloc
  152.             to be "ads_malloc()", "ads_realloc(), "ads_free()"
  153.             and "ads_calloc()" to round this substitution out.
  154.             The point is to have all Rx apps which must malloc
  155.             objects to be fred by
  156.             AutoCAD or another Rx app, or vice versa, to draw from the
  157.             same memory management system, or else it doesn't work.
  158.  
  159.             An application is free to use its own memory management,
  160.             or that of the system rumtime libraries, by #undef'ing
  161.             these symbols, as long as such usage has balanced malloc
  162.             and free() calls within the application.  Such an application
  163.             can utlize both memory pools from a single module
  164.             too.
  165. */
  166.  
  167. #ifdef malloc
  168. #undef malloc
  169. #endif
  170.  
  171. #ifdef calloc
  172. #undef calloc
  173. #endif
  174.  
  175. #ifdef free
  176. #undef free
  177. #endif 
  178.  
  179. #ifdef realloc
  180. #undef realloc
  181. #endif
  182.  
  183. /* 
  184.    ads_malloc()/ads_free()/ads_msize()/ads_realloc()/ads_calloc() will
  185.    be defined in ads.h  #if defined(ACRXAPP) && defined(solaris)
  186. */
  187.  
  188. #define malloc    ads_malloc
  189. #define free    ads_free
  190. #define realloc    ads_realloc
  191. #define calloc    ads_calloc
  192.  
  193. #endif /* defined(ACRXAPP) && defined(Solaris) */
  194.  
  195. #ifdef _adslib_h_const                /* Clean up after yourself */
  196. #undef const
  197. #undef _adslib_h_const
  198. #endif  /* !_adslib_h_const */
  199.  
  200.  
  201. #endif  /* !_adslib_h */
  202.